﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;

namespace 配置系统集成2.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private readonly IOptionsSnapshot<Proxy> proxy;
        private readonly IConfiguration configuration;

        public TestController(IConfiguration configuration,IOptionsSnapshot<Proxy> proxy)
        {
            this.configuration = configuration;
            this.proxy = proxy;
        }

        [HttpPost]
        public IActionResult Test()
        {
            return Ok(proxy.Value.address + "," + configuration["Test"] + "," + configuration["name"] );
        }
    }
}
